package com.jacobson.huobi.mvp.model

import com.alibaba.fastjson.JSONObject
import com.jacobson.core.di.annotation.ActivityScope
import com.jacobson.core.framework.repository.IRepositoryManager
import com.jacobson.core.mvp.BaseModel
import com.jacobson.huobi.api.EditSoftwareApi
import com.jacobson.huobi.api.LoginAndRegisterApi
import com.jacobson.huobi.entities.response.CommonResponse
import com.jacobson.huobi.mvp.contract.EditPasswordContract
import com.jacobson.huobi.mvp.contract.EditSoftwareContract
import io.reactivex.Observable
import okhttp3.MultipartBody
import javax.inject.Inject

@ActivityScope
class EditSoftwareModel @Inject constructor(
    repositoryManager: IRepositoryManager
) : BaseModel(repositoryManager), EditSoftwareContract.Model {
    private val loginAndRegisterApi =
        repositoryManager.obtainRetrofitService(LoginAndRegisterApi::class.java)

    private val editSoftwareApi =
        repositoryManager.obtainRetrofitService(EditSoftwareApi::class.java)

    override fun logout(): Observable<CommonResponse<JSONObject>> {
        return loginAndRegisterApi.logout()
    }

    override fun logcatUpload(
        file: MultipartBody.Part,
        model: String,
        version: String
    ): Observable<CommonResponse<String>> {
        return editSoftwareApi.logcatUpload(file, model, version)
    }

}